export default {
	data(){
		return {
			targetPos: {
				top: 0,
				left: 0
			},
			curPos:{
				top: -100,
				left: -100
			},
			start:false,
			xMove:'none',
			yMove:'none',
		}
	},
	methods:{
		clickAddBtn(e){
			if(this.start == true) return ;
			// 确定当前点击位置
			this.curPos.left = e.touches[0].clientX - 12;
			this.curPos.top = e.touches[0].clientY - 12;
			setTimeout(()=>{
				// 加入动效
				this.start = true;
				// 修改移动目标点
				const offsetX = this.targetPos.left - this.curPos.left;
				const offsetY = this.targetPos.top - this.curPos.top;
				this.xMove = `translateX(${offsetX}px);`
				this.yMove = `translateY(${offsetY}px);`
			},100)
			setTimeout(()=>{
				this.start = false;
				this.xMove = 'none';
				this.yMove = 'none';
				this.curPos.left = -100;
				this.curPos.top = -100;
			},800)
		},
	}
}